

function addArduinoCod(Blockly) {







    //8x8点阵屏初始化
Blockly.Arduino['ph_max'] = function(block) {
    var dropdown_din = this.getFieldValue('din');
    var dropdown_cs = this.getFieldValue('cs');
    var dropdown_clk = this.getFieldValue('clk');
    var value_maxs = Blockly.Arduino.valueToCode(this, 'maxs', Blockly.Arduino.ORDER_ATOMIC);
    
    Blockly.Arduino.definitions_['setup_ph_max'] = '  ledmatrix.init();\n  ledmatrix.setIntensity(1);\n  ledmatrix.clearMatrix();\n';
    Blockly.Arduino.definitions_['include_ph_max'] = '#include <MaxMatrix.h>\n#define DIN_PIN    '+dropdown_din+'\n#define CS_PIN    '+dropdown_cs+'\n#define CLK_PIN    '+dropdown_din;
    Blockly.Arduino.definitions_['ph_max'] = '\nMaxMatrix ledmatrix(DIN_PIN,CS_PIN,CLK_PIN,'+value_maxs+');\n';
    return '';
}
//8x8点阵屏单点亮或灭
Blockly.Arduino['ph_maxpoint'] = function(block) {
    var dropdown_draw = this.getFieldValue('draw');
    // var value_maxpoint1 = Blockly.Arduino.valueToCode(this, 'maxpoint1', Blockly.Arduino.ORDER_ATOMIC);
    // var value_maxpoint2 = Blockly.Arduino.valueToCode(this, 'maxpoint2', Blockly.Arduino.ORDER_ATOMIC);
    return 'ledmatrix.drawShape(ledmatrix.getMouthShape('+dropdown_draw+'));';
}

//8x8点阵屏单点亮
Blockly.Arduino['ph_x8leddisplay'] = function(block) {
  var dropdown_draw = this.getFieldValue('draws');
  // var value_maxpoint1 = Blockly.Arduino.valueToCode(this, 'maxpoint1', Blockly.Arduino.ORDER_ATOMIC);
  // var value_maxpoint2 = Blockly.Arduino.valueToCode(this, 'maxpoint2', Blockly.Arduino.ORDER_ATOMIC);
  return 'ledmatrix.writeFull('+dropdown_draw+');';
}

    return Blockly;
}

module.exports = addArduinoCod;

